<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        div {
            width: 1000px;
            height: 200px;
            margin: 100px auto;
            text-align: center;
            color: red;
            font-size: 30px;
            font-weight: bold;
        }
        
    </style>
</head>
<body>
    <!-- 伍志诚的代码！ -->

    <script>

        var dt2 = new Date();
        var startTime = dt2.getTime();
        console.log(startTime);



        var dt = new Date("2021-10-01");
        console.log(dt);
        var endTime = dt.getTime();
        console.log(endTime);
      
        var time = (endTime - startTime) / 1000 ;
        

        var day = Math.floor(time / 60 / 60 /24);
        var hours =  Math.floor(time/ 60 / 60 % 24);
        var minutes = Math.floor(time % 3600/ 60 );
        var seconds =  Math.floor(time % 60);
       
        

        var str ="<div>距离国庆还有"+day+"天"+hours+"小时"+minutes+"分钟"+seconds+"秒！<div>"
        document.write(str);


    </script>
</body>
</html>